package com.gexiao.config;

import com.gexiao.bean.Car;
import com.gexiao.dao.DemoDao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@ComponentScan(value = {"com.gexiao.*"})
@Configuration
@Profile("dev")
public class MainConfig {

    @Bean(name = "demoDao2")
    //优先使用
//    @Primary
    public DemoDao demoDao(){
        DemoDao demoDao = new DemoDao();
        demoDao.setLabel("333");
        return demoDao;
    }

    @Bean(name = "car")
    @Profile("default")
    public Car car(){
        return new Car();
    }
}
